import VConsole from 'vconsole'

let vConsole
function createVConsole() {
  if (vConsole) {
    vConsole.destroy()
  }
  vConsole = new VConsole({ theme: 'dark' })
}
function updateVConsolePosition() {
  window.localStorage.setItem('vConsole_switch_x', `${window.document.documentElement.offsetWidth / 2 - 70}`)
  window.localStorage.setItem('vConsole_switch_y', `${window.document.documentElement.offsetHeight}`)
}
updateVConsolePosition()
createVConsole()
window.addEventListener('resize', () => {
  updateVConsolePosition()
  createVConsole()
})
